-
Notifications
You must be signed in to change notification settings - Fork 94
add example for gpt-oss #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jssmith
commented
Aug 6, 2025
|
|
||
| from openai_agents.model_providers.workflows.gpt_oss_workflow import GptOssWorkflow | ||
|
|
||
| ollama_client = AsyncOpenAI( |
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Client needs to be created outside of CustomModelProvider as otherwise we have sandboxing issues:
future: <Task finished name='Task-47 (workflow: GptOssWorkflow, id: litellm-gpt-oss-workflow-id, run: 019881a0-034a-7a48-a1e0-9412fa0b9bbb)' coro=<AsyncClient.aclose() done, defined at /Users/jssmith/t/samples-python-2/.venv/lib/python3.12/site-packages/httpx/_client.py:1978> exception=RestrictedWorkflowAccessError('Cannot access threading.local.__mro_entries__ from inside a workflow. If this is code from a module not used in a workflow or known to only be used deterministically from a workflow, mark the import as pass through.')>
Traceback (most recent call last):
File "/Users/jssmith/t/samples-python-2/.venv/lib/python3.12/site-packages/httpx/_client.py", line 1985, in aclose
await self._transport.aclose()
File "/Users/jssmith/t/samples-python-2/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 406, in aclose
await self._pool.aclose()
File "/Users/jssmith/t/samples-python-2/.venv/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 353, in aclose
await self._close_connections(closing_connections)
File "/Users/jssmith/t/samples-python-2/.venv/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 343, in _close_connections
with AsyncShieldCancellation():
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jssmith/t/samples-python-2/.venv/lib/python3.12/site-packages/httpcore/_synchronization.py", line 203, in __init__
self._backend = current_async_library()
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jssmith/t/samples-python-2/.venv/lib/python3.12/site-packages/httpcore/_synchronization.py", line 26, in current_async_library
import sniffio
File "/Users/jssmith/t/samples-python-2/.venv/lib/python3.12/site-packages/temporalio/worker/workflow_sandbox/_importer.py", line 497, in __call__
return self.current(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jssmith/t/samples-python-2/.venv/lib/python3.12/site-packages/temporalio/worker/workflow_sandbox/_importer.py", line 248, in _import
mod = importlib.__import__(name, globals, locals, fromlist, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1466, in __import__
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 999, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/Users/jssmith/t/samples-python-2/.venv/lib/python3.12/site-packages/sniffio/__init__.py", line 12, in <module>
from ._impl import (
File "/Users/jssmith/t/samples-python-2/.venv/lib/python3.12/site-packages/temporalio/worker/workflow_sandbox/_importer.py", line 497, in __call__
return self.current(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jssmith/t/samples-python-2/.venv/lib/python3.12/site-packages/temporalio/worker/workflow_sandbox/_importer.py", line 248, in _import
mod = importlib.__import__(name, globals, locals, fromlist, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1470, in __import__
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 999, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/Users/jssmith/t/samples-python-2/.venv/lib/python3.12/site-packages/sniffio/_impl.py", line 11, in <module>
class _ThreadLocal(threading.local):
File "/Users/jssmith/t/samples-python-2/.venv/lib/python3.12/site-packages/temporalio/worker/workflow_sandbox/_restrictions.py", line 1016, in __getattribute__
state.assert_child_not_restricted(__name)
File "/Users/jssmith/t/samples-python-2/.venv/lib/python3.12/site-packages/temporalio/worker/workflow_sandbox/_restrictions.py", line 852, in assert_child_not_restricted
raise RestrictedWorkflowAccessError(
temporalio.worker.workflow_sandbox._restrictions.RestrictedWorkflowAccessError: Cannot access threading.local.__mro_entries__ from inside a workflow. If this is code from a module not used in a workflow or known to only be used deterministically from a workflow, mark the import as pass through.
tconley1428
approved these changes
Aug 7, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What was changed
Added an example using gpt-oss with a tool call.
Why?
Checklist
Closes
How was this tested: